var finished = true;// 上传是否结束


function $(obj) {
	return document.getElementById(obj); // 通过id取
}

function requestStatus() {

	// if(finished)
	var req = createRequest();

	if (req == null) {
		alert("你这是神马浏览器啊");
	}

	req.open("GET", "ProgressUploadServlet");
	req.onreadystatechange = function() {
		callback(req);
	};

	req.send(null);
	setTimeout("requestStatus()", 1000);

}

function showStatus() {
	requestStatus();
}

function callback(req) {
	if (req.readyState == 4) {
		if (req.status != 200) {
			// debug("发生错误.req.statue:"+req.status+"");
			return;
		}
	}

	var ss = req.responseText.split("||");
	$("percentage").innerHTML += ss[0]+"...";
}

function createRequest() {
	if (window.XMLHttpRequest) {
		return XMLHttpRequest();
	} else {
		try {

			return new ActiveXobject("Msxml2.XMLHTTP");
		} catch (e) {
			// TODO: handle exception
			return new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return null;
}